<?php

/**
 * Description of Dimension3Manager
 *
 * @author yahn
 */
class Dimension3Manager {
    private $_db;
    
    public function __construct($db) {
        $this->setDb($db);
    }
    
    public function setDb($db) {
        $this->_db = $db;
    }
    
    public function add(Dimension3 $d3) {
        $q = $this->_db->prepare('INSERT INTO Dimension3 VALUES (:refD1,:refD2, :niveau, :descr)');
        $q->bindValue(':refD1', $d3->getDimension1()->getRefD1());
        $q->bindValue(':refD2', $d3->getDimension2()->getRefD2());
        $q->bindValue(':niveau', $d3->getNiveau());
        $q->bindValue(':descr', $d3->getDescr());
        $q->execute(); 
    }
    
    public function delete(Dimension3 $d3) {
        $q = $this->_db->prepare('DELETE FROM Dimension3 WHERE refD1 = :refD1 and refD2 = :refD2 and niveau = :niveau');
        $q->bindValue(':refD1', $d3->getRefD1()->getRefD1);
        $q->bindValue(':refD2', $d3->getRefD2()->getRefD2);
        $q->bindValue(':niveau', $d3->getNiveau());
        $q->execute(); 
    }
}

?>
